<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.ld.com/shield/tags" prefix="shield"%>
<%@ taglib uri="http://www.ld.com/jsp/plugin" prefix="plugin"%>
<%@ page trimDirectiveWhitespaces="true" %>
<fmt:setLocale value="zh_CN"/>
<shield:permssion type="button">
<form action="${ctxPathA}/usercenter/sysusertemp/addOrUpdate" method="post" autocomplete="off" class="show-info">
	<shield:token/>
    <input id="id" name="id" type="hidden" maxlength="100" value="${model.id }">
    <table class="tab-show">
    	<colgroup>
    		<col width="25%">
    		<col width=""> 
    	</colgroup>
		<tr>
			<th>
				<label><font color="red">*</font>账号名称：</label>
			</th>
         	<td><input type="text" name="accountName" class="" value="${model.accountName}"></td>
		</tr>
		<tr>
			<th>
				<label>登录账号：</label>
			</th>
         	<td>${sessionScope.session_user.loginCode}<span class="tips">[与主账号相同]</span></td>
		</tr>
		<tr>
			<th>
				<label><font color="red">*</font>登录密码：</label>
			</th>
         	<td>
<c:if test="${empty model }">
         		<input type="text" name="password" class="" style="width: 70%;" value="${randomPwd }" readonly="readonly">
</c:if>
<c:if test="${not empty model }">
         		<input type="text" name="password" class="" style="width: 70%;" value="******" readonly="readonly">
</c:if>
         		<input type="button" value="重置密码" class="refreshTempPwd">
         		<span class="tips">密码只显示1次，请注意妥善保存！！！如忘记请重置</span>
         	</td>
		</tr>
		<tr>
			<th>
				<label><font color="red">*</font>有效期至：</label>
			</th>
         	<td><input type="text" name="dateUntil" dateFmt="yyyy-MM-dd HH:mm:ss" shieldSettings="{minDate:'%y-%M-%d',maxDate:'%y-%M-{%d+30}'}" 
         		value="<fmt:formatDate value="${model.dateUntil}" pattern="yyyy-MM-dd HH:mm:ss"/>" class="Wdate">
         		<span class="tips">临时账号有效期最多30天</span>
         	</td>
		</tr>
		<tr>
			<th>
				<label>允许访问的ip：</label>
			</th>
         	<td>
         		<textarea rows="" cols="" name="allowIp" maxlength="500">${model.allowIp }</textarea>
         		<span class="tips">多个ip用回车区分</span>
         	</td>
		</tr>
		<tr>
			<th>
				<label>状态：</label>
			</th>
         	<td><shield:switchOput data="-1=删除|正常" value="${model.state}"></shield:switchOput></td>
		</tr>
    </table>
    <div class="taCenter">
		<input class="button" type="submit" value="提交"/>
    	<input class="button default" type="reset" value="重置"/>
    </div>
    <script type="text/javascript">
	    $(".refreshTempPwd").click(function(){
	    	var $this = $(this);
	        const expect = 16;
	        let str = Math.random().toString(36).substring(2);
	        while (str.length < expect) {
	          str += Math.random().toString(36).substring(2);
	        }
	        str = str.substring(0, expect);
	    	$this.prev().prop("disabled", false).val(str);
		});
    </script>
</form>
</shield:permssion>